package com.tjetc.config;

import com.tjetc.properties.AliOssProperties;
import com.tjetc.properties.JwtProperties;
import com.tjetc.utils.AliOssUtil;
import com.tjetc.utils.JwtUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 配置类，用于创建AliOssUtil对象
 */
@Configuration
@Slf4j
public class JwtConfiguration {

    @Bean
    @ConditionalOnMissingBean
    public JwtUtils jwtUtils(JwtProperties jwtProperties){
        log.info("开始创建Jwt工具类对象：{}",jwtProperties);
        return new JwtUtils(jwtProperties.getSecretKey(),
                jwtProperties.getTtl());
    }
}
